﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

// **********************************************************************
// Copyright (C) XM
// Author: 赵思佳
// Date: 2019-01-17
// Desc: 代码逻辑文件
// **********************************************************************
namespace SpaceDFramework
{
    public partial class MonoBehaviourSimplify:MonoBehaviour
    {
        public void Delay(float delayTime, Action OnFinished) {
            StartCoroutine(DelayCoroutine(delayTime, OnFinished));
        }
        private IEnumerator DelayCoroutine(float delayTime, Action OnFinished) {
            yield return new WaitForSeconds(delayTime);
            if(OnFinished!=null)
                OnFinished.Invoke();
        }
    }
    public class DelayWithCoroutine : MonoBehaviourSimplify {
        public override void OnBeforeDestory()
        {
            
        }

        private void Start()
        {
            Delay(5, () => { Debug.Log("5s之后"); });
        }
    }
}
